package com.pioneer.gui.invoice.view;

import javax.swing.JTable;
import javax.swing.JComboBox;
import javax.swing.DefaultCellEditor;

import com.pioneer.gui.invoice.model.InvoiceTableModel;
import com.pioneer.gui.invoice.model.InvoiceModel;
import com.pioneer.gui.invoice.model.DropDownList;


import com.pioneer.gui.invoice.util.Constants;

public class DetailsTable
extends JTable
implements Constants
{
	public DetailsTable(InvoiceModel model)
	{
	    InvoiceTableModel invoiceTableModel=model.getInvoiceDetails();
		this.setModel(invoiceTableModel);
		JComboBox itemList=new JComboBox(new DropDownList(ITEM_NO));
		itemList.setEnabled(true);
		this.getColumn(invoiceTableModel.getColumnName(0)).setCellEditor(new DefaultCellEditor(itemList));		
		this.getColumn(invoiceTableModel.getColumnName(1)).setCellEditor(new DefaultCellEditor(new JComboBox(new DropDownList(ITEM_TYPE))));
		this.getColumn(invoiceTableModel.getColumnName(2)).setPreferredWidth(400);
		this.getColumn(invoiceTableModel.getColumnName(4)).setCellEditor(new DefaultCellEditor(new JComboBox(new DropDownList(QTY_TYPE))));
	}	
}